import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    // url: '/api/blade-user/list',
    url: '/api/ManageUser/GetUserList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const remove = (params) => {
  return request({
    // url: '/api/blade-user/remove',
    url: '/api/ManageUser/DelUser',
    method: 'post',
    data: params
    // params: {
    //   ids,
    // }
  })
}

export const add = (row) => {
  return request({
    // url: '/api/blade-user/submit',
    url: '/api/ManageUser/AddOrEditUser',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    // url: '/api/blade-user/update',
    url: '/api/ManageUser/AddOrEditUser',
    method: 'post',
    data: row
  })
}

// 角色分配
export const grant = (params) => {
  return request({
    url: '/api/ManageUser/GrantUserRole',
    method: 'post',
    data: params
    // params: {
    //   userIds,
    //   roleIds,
    // }
  })
}

export const getUser = (id) => {
  return request({
    // url: '/api/blade-user/detail',
    url: '/api/ManageUser/GetUserInfo',
    method: 'get',
    params: {
      id,
    }
  })
}

export const getUserInfo = () => {
  return request({
    url: '/api/blade-user/info',
    method: 'get',
  })
}


// 重置密码
export const resetPassword = (params) => {
  return request({
    url: '/api/ManageUser/ResetPwd',
    method: 'post',
    data: params
    // params: {
    //   userIds,
    // }
  })
}

export const updatePassword = (params) => {
  return request({
    url: '/api/ManageUser/EditUserPassword',
    method: 'post',
    data: params
  })
}

// 所属角色
export const getRoleTree = (tenantId) => {
  return request({
    url: '/api/ManageUser/GetUserRoleDeployList',
    method: 'get',
    params: {
      tenantId,
    }
  })
}
// 获取教师关联用户
export const getJsTree = (tenantId) => {
  return request({
    url: '/api/ManageUser/GetSelectTeacherList',
    method: 'get',
    params: {
      tenantId,
    }
  })
}
// 获取学生关联用户
export const getXsTree = (tenantId) => {
  return request({
    // url: '/api/ManageUser/GetSelectFamilyList',
    url: '/api/ManageUser/GetSelectFamilyList',
    method: 'get',
    params: {
      tenantId,
    }
  })
}

//用户组列表
export const getUserUserGroupList = (tenantId) => {
  return request({
    url: '/api/ManageUser/GetUserUserGroupList',
    method: 'get',
    params: {
      tenantId,
    }
  })
}
//用户组弹窗确定
export const grantUserUserGroup = (params) => {
  return request({
    url: '/api/ManageUser/GrantUserUserGroup',
    method: 'post',
    data: params
  })
}

//获取所属分组已选ID
export const getUserSomeUserGroup = (params) => {
  return request({
    url: '/api/ManageUser/GetUserSomeUserGroup',
    method: 'get',
    params: params
  })
}



